package com.example.backetballgame.player;

import com.example.backetballgame.item.GameItem;

import javax.swing.*;
import java.util.List;

/**
 * player
 */
public class Player extends GameItem {

    private Integer guid;

    private List<Skill> skillList;
    private int fatigue;

    private int strength;

    private int defense;

    public Player(String name, int price) {
        super(name, price);
    }


    public List<Skill> getSkillList() {
        return skillList;
    }

    public void addSkill(Skill skill) {
        skillList.add(skill);
    }

    public void removeSkill(Skill skill) {
        skillList.remove(skill);
    }

    public void setSkillList(List<Skill> skillList) {
        this.skillList = skillList;
    }

    public Integer getGuid() {
        return guid;
    }

    public void setGuid(Integer guid) {
        this.guid = guid;
    }

    public int getFatigue() {
        return fatigue;
    }

    public void setFatigue(int fatigue) {
        this.fatigue = fatigue;
    }

    public void incrementFatigue(int fatigue) {
        this.fatigue = Math.min(100, this.fatigue + fatigue);
    }

    @Override
    public int getStrength() {
        return strength;
    }

    @Override
    public void setStrength(int strength) {
        this.strength = strength;
    }

    @Override
    public int getDefense() {
        return defense;
    }

    @Override
    public void setDefense(int defense) {
        this.defense = defense;
    }

    public double calculateOverallAbility(){
        // 定义权重值
        double strengthWeight = 0.4;
        double defenseWeight = 0.3;
        double fatigueWeight = 0.3;

        // 计算综合能力值
        double overallAbility = (strength * strengthWeight) + (defense * defenseWeight) + ((100 - fatigue) * fatigueWeight);
        return overallAbility;
    }
}